<% filter_hash = {:filter => params[:filter]} %>
<div class="alphabetical_pagination">
  <ul>
    <li class="<%= current_page == "latest" ? "current_page" : "" %>"><%= link_to "Latest ", {:id => params[:id], :page => "latest"}.merge(filter_hash) %></li> 
    <% for page in pages -%>
        <% current_page_class = page==current_page ? "current_page" : "" -%>
        <% if page_totals[page]>0 -%>
            <li class="<%= current_page_class %>"><%= link_to h(page), {:id => params[:id], :page => page}.merge(filter_hash) %></li>
        <% else -%>
            <li class="disabled_page <%= current_page_class %>"><%= h(page) %></li>
        <% end -%>
    <% end -%>
    <li class="<%= current_page == "all" ? "current_page" : "" %>"><%= link_to "All", {:id => params[:id], :page => "all"}.merge(filter_hash) %></li>
  </ul>
  <%=  link_to("Clear Filter", CGI::unescape(request.url).gsub(/filter\[.+\]=[0-9]*[&]?/,""), :style => "display:none") unless params[:filter].blank? %>
</div>
